from django.conf.urls import url

from exam import views as exam_views
from . import views
from . import apis


urlpatterns = [
    url(
        regex=r"add/$",
        view=views.CourseCreateView.as_view(),
        name='add'
    ),
    url(
        regex=r"list/$",
        view=views.CourseListView.as_view(),
        name='list'
    ),
    url(
        regex=r"edit/(?P<pk>\d+)$",
        view=views.CourseUpdateView.as_view(),
        name='edit'
    ),
    url(
        regex=r"^(?P<pk>\d+)/calendar/$",
        view=views.CourseCalendarView.as_view(),
        name='calendar'
    ),
    url(
        regex=r"^(?P<pk>\d+)/modules/$",
        view=apis.GetCourseModulesApi.as_view(),
        name='get_modules'
    ),
    url(
        regex=r"^(?P<pk>\d+)/student_modules/$",
        view=apis.GetStudentCourseModulesApi.as_view(),
        name='get_student_modules'
    ),
    url(
        regex=r"^supervisor_modules/$",
        view=apis.GetSupervisorCourseModulesViewApi.as_view(),
        name='get_supervisor_modules'
    ),
    url(
        regex=r"^(?P<course_id>\d+)/lecture/(?P<lecture_id>\d+)",
        view=views.LectureView.as_view(),
        name='edit_lecture'
    ),
    url(
        regex=r"^(?P<course_id>\d+)/lecture/",
        view=views.LectureView.as_view(),
        name='create_lecture'
    ),
    url(
        regex=r"^(?P<course_id>\d+)/exam/(?P<exam_id>\d+)",
        view=exam_views.ExamTeacherView.as_view(),
        name='edit_exam'
    ),
    url(
        regex=r"^(?P<course_id>\d+)/exam/",
        view=exam_views.ExamTeacherView.as_view(),
        name='create_exam'
    ),
    url(
        regex=r"^module/(?P<module_id>\d+)/$",
        view=views.ModuleListView.as_view(),
        name='list_modules'
    ),
    url(
        regex=r"^module/(?P<module_id>\d+)/"
        "content/(?P<model_name>\w+)/create/$",
        view=views.ContentCreateUpdateView.as_view(),
        name='create_content'
    ),
    url(
        regex=r"^module/(?P<module_id>\d+)/"
        "content/(?P<model_name>\w+)/(?P<id>\d+)/$",
        view=views.ContentCreateUpdateView.as_view(),
        name='update_content'
    ),
    url(
        regex=r"^content/(?P<id>\d+)/delete/$",
        view=views.ContentDeleteView.as_view(),
        name='delete_content'
    ),
    url(
        regex=r"^(?P<pk>\d+)/students/$",
        view=views.CourseStudentListView.as_view(),
        name='students'
    ),
    url(
        regex=r"^(?P<slug>\w+)/students/$",
        view=views.CourseUnitedStudentListView.as_view(),
        name='united_students'
    ),
    url(
        regex=r"^lecture/(?P<lecture_id>\d+)/$",
        view=views.LectureStudentView.as_view(),
        name='lecture'
    ),
    url(
        regex=r"^student/detail/(?P<pk>\d+)/(?P<course_id>\d+)/(?P<slug>\w+)$",
        view=views.StudentDetailView.as_view(),
        name='student_detail'
    ),
    url(
        regex=r"^admin_calendar/$",
        view=views.AdminCalendarView.as_view(),
        name='admin_calendar'
    ),
    url(
        regex=r"^get_conflict/$",
        view=apis.GetConflictView.as_view(),
        name='get_conflict'
    )
]
